import 'dart:ui';

class LDXSizeFit {
  static double pyhsicalWidth = 0;
  static double pyhsicalhHeight = 0;
  static double screenWidth = 0;
  static double screenHeight = 0;
  static double dpr = 0;
  static double statusHeight = 0;
  static double rpx = 0;
  static double px = 0;

  static void initialize({double standardSize = 750}) {
    screenWidth = window.physicalSize.width;
    screenHeight = window.physicalSize.height;
    //2、获取dpr
    rpx = window.devicePixelRatio;
    //3、宽度和高度
    screenWidth = pyhsicalWidth / dpr;
    screenHeight = pyhsicalhHeight / dpr;
    //4、状态栏高度
    statusHeight = window.padding.top / dpr;
    //5、计算rpx的大小
    rpx = screenWidth / standardSize;
    px = screenWidth / standardSize * 2;
  }

  // 按照rxp来设置
  static double setRPx(double size) {
    return rpx * size;
  }
  // 按照像素来设置
  static double setPx(double size) {
    return px * size;
  }
}